"use strict";
const Base = require("../base");
const LANG = require("../../language"); // 插件语言库
// 内存shell模块
class MemoryManage extends Base {
  precheck(){
    if(this.shelltype=="jsp"){
      return true;
    }
    return false;
  }
  createForm(cell) {
    var str = [
      {
        type: "radio",
        name: "ServletAction",
        label: LANG["core"]["memory_manage"]["form"]["getAllServlet"],
        checked: "1",
        value: "getAllServlet",
        position: "label-right",
      },
      {
        type: "radio",
        name: "ServletAction",
        label: LANG["core"]["memory_manage"]["form"]["unLoadServlet"],
        value: "unLoadServlet",
        position: "label-right",
        list: [
          {
            type: "input",
            name: "ServiceName",
            label: LANG["core"]["memory_manage"]["form"]["ServiceName"],
          },
          {
            type: "input",
            name: "UrlPath",
            label: LANG["core"]["memory_manage"]["form"]["UrlPath"],
          },
        ],
      },
      { type: "settings", labelWidth: 150, inputWidth: 200 },
    ];
    var form = cell.attachForm(str);
    this.form = form;
  }
  getArgs() {
    let args = {};
    let ServletAction = this.form.getCheckedValue("ServletAction");
    args["ServletAction"] = ServletAction;
    this.payloadtype = "default";

    switch (ServletAction) {
      case "getAllServlet":
        break;
      case "unLoadServlet":
        args["ServiceName"] = this.form.getItemValue("ServiceName");
        args["UrlPath"] = this.form.getItemValue("UrlPath");
      default:
        break;
    }
    console.log(args);

    return args;
  }
}

module.exports = MemoryManage;
